package com.wingscode.modules.sys.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wingscode.common.utils.PageUtils;
import com.wingscode.common.utils.Query;
import com.wingscode.modules.sys.dao.AgentApplyDao;
import com.wingscode.modules.sys.entity.AgentApplyEntity;
import com.wingscode.modules.sys.service.AgentApplyService;
import org.springframework.stereotype.Service;

import java.util.Map;


/**
 * 渠道用户申请
 *
 * @author yan
 */
@Service("agentApplyService")
public class AgentApplyServiceImpl extends ServiceImpl<AgentApplyDao, AgentApplyEntity> implements AgentApplyService {

	@Override
    public PageUtils queryPage(Map<String, Object> params) {
		Integer level = null;
		String company = "", startTime = "", endTime = "";

		if (params.containsKey("level") && params.get("level") != null && !params.get("level").toString().isEmpty())
			level = Integer.parseInt(params.get("level").toString());
		if (params.containsKey("company"))
			company = (String) params.get("company");
		if (params.containsKey("startTime"))
			startTime = (String) params.get("startTime");
		if (params.containsKey("endTime"))
			endTime = (String) params.get("endTime");

		IPage<AgentApplyEntity> page = this.baseMapper.getList(new Query<AgentApplyEntity>().getPage(params), company, startTime, endTime, level);

		return new PageUtils(page);
    }
}
